package com.xtedu.examproject.service;

import com.xtedu.examproject.dao.base.ClassesDao;
import com.xtedu.examproject.dao.impl.ClassesDaoImpl;
import com.xtedu.examproject.entity.Classes;
import com.xtedu.examproject.util.PageHelper;

import java.util.List;

public class ClassesService {
    private ClassesDao classesDao;

    public ClassesService(){
        classesDao = new ClassesDaoImpl();
    }

    public int insertClasses(Classes classes) throws Exception {
        return classesDao.insert(classes);
    }

    public int deleteClasses(Classes classes) throws Exception {
        return classesDao.delete(classes);
    }

    public int updateClasses(Classes classes) throws Exception {
        return classesDao.update(classes);
    }

    public Classes findClassesById(int id) throws Exception {
        return classesDao.findById(id);
    }

    public List<Classes> findAllClasses() throws Exception {
        return classesDao.findAll();
    }

    public PageHelper findAllClassesByPage(int pageIndex, int pageSize) throws Exception {
        return classesDao.findAllByPage(pageIndex, pageSize);
    }

    public PageHelper findClassesByConditionByPage(int pageIndex, int pageSize, int classId, String className, int subjectId, int courseId, int teacherId, int roomId) throws Exception {
        return classesDao.findByConditionByPage(pageIndex, pageSize, classId, className, subjectId, courseId, teacherId, roomId);
    }
}
